package com.egame.manage.biz.web.controller.gc;
import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;

import cn.egame.common.servlet.WebUtils;
import cn.egame.interfaces.pu.AppParameter;
import com.egame.manage.biz.server.ManageClient;
import com.egame.manage.biz.web.controller.BaseController;
import com.lenovo.manager.business.domain.UserBean;

@Controller
@RequestMapping("/tv/manage")
public class ManageGameController extends BaseController{
	
	public ManageGameController(){		
	}
	public ManageGameController(HttpServletRequest req, HttpServletResponse resp) {
		super(req, resp);
	}

	@RequestMapping(value = "/list/channel", method = {RequestMethod.GET,RequestMethod.POST})	
	public ModelAndView listOperationManageChannel(HttpServletRequest req, HttpServletResponse resp)throws Exception{
		if(req.getSession().getAttribute(com.egame.manage.biz.utils.ConstVar.USER_SESSION_KEY) != null){
			UserBean userBean = (UserBean) req.getSession().getAttribute(com.egame.manage.biz.utils.ConstVar.USER_SESSION_KEY);
			loginUserId = userBean.getOperatorId();
		}
		int parentId = WebUtils.getInt(req,"parentId",32);		
		List<Integer> channerlIdsIntegers = ManageClient.getInstance().listAppParameterIdsByParentId(appId, loginUserId, parentId);
		List<AppParameter> list = ManageClient.getInstance().listAppParameterByIds(appId, loginUserId, channerlIdsIntegers); 
		ModelAndView mav = new ModelAndView("/new/channel"); 
		mav.addObject("listChannel", list);
		
		return mav;
	}
		
}
